/**
 * 工程名：COMMON
 * 包名：com.mt.common.safe
 * 文件名：Function.java
 */
package com.mt.system.domain;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

import com.mt.component.domain.Common;
import com.mt.utils.StringUtils;



/**
 * 类名称：Function <br>
 * 类描述：系统功能 <br>
 * 创建人： 马腾 <br>
 * 创建时间：2012-10-18 下午11:30:58 <br>
 */
@Entity
@Table(name="CFG_SYS_FUNCTION")
public class Funct extends Common implements Serializable {
	
	private static final long serialVersionUID = -2427130280444628222L;
	
	private String name;//功能的名称
	private String shortcutKey;//快捷键
	private String method;//功能调用的方法
	
	@Column(name = "FUN_NAME",length = 32 , unique=true)
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
	@Column(name = "FUN_SHORT_KEY",length = 4)
	public String getShortcutKey() {
		return shortcutKey;
	}
	public void setShortcutKey(String shortcutKey) {
		this.shortcutKey = shortcutKey;
	}
	
	@Column(name = "FUN_METHOD",length = 16)
	public String getMethod() {
		return method;
	}
	public void setMethod(String method) {
		this.method = method;
	}
	
	@Override
	public boolean equals(Object obj) {
		if(obj instanceof Funct){
			Funct funct = (Funct)obj;
			if(StringUtils.isEmpty(funct.getId())) return false;
			return funct.getId().equals(getId());
		}
		return false;
	}
	
	@Override
	public int hashCode() {
		return getId()==null ? 0 : getId().hashCode();
	}
	
	@Override
	public String toString() {
		return "Function [name=" + name + ", shortcutKey=" + shortcutKey
				+ ", method=" + method + "]";
	}
}
